<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<html >
<head>
    <meta charset="UTF-8">
    <title>Problem Set - Online Judge</title>
    <link rel="stylesheet" th:href="@{/css/styles.css}" >
    <script th:src="@{/js/jquery-1.7.2.js}"></script>
    <script th:src="@{/js/gdoj.js}"></script>
</head>

<body>
<div th:replace="common::web-navbar"></div>
<div class="container">
    <div class="content">
        <div class="content-with-sidebar">
            <div th:replace="admin/admin-common::admin-navbar"></div>
            <div class="roundbox">
                <table class="problem rtable">
                    <tr class="header">
                        <th class="id left-item">[[#{problemid}]]</th>
                        <th class="title">[[#{problem}]]</th>
                        <th class="solved">
                            <img th:title="#{solved}" th:src="@{/img/statistic.png}" style="vertical-align: middle;">
                        </th>
                        <th class="ratio"></th>
                    </tr>
                    <tr th:if="${pageInfo.size == 0}"><td class="left-item dark" colspan="5" style="text-align: left;">There is no records.</td></tr>
                    <tr th:each="problem,stat : ${pageInfo.list}" th:class="${stat.odd}?'dark'">
                        <td class="id left-item"><a th:href="@{/problemset/problem/{problem_id}(problem_id=${problem.problem_id})}" th:text="${problem.problem_id}"></a></td>
                        <td class="title">
                            <div class="problem-link" style="float:left;vertical-align: middle;">
                                <a th:href="@{/problemset/problem/{problem_id}(problem_id=${problem.problem_id})}" th:text="${problem.title}"></a>
                            </div>
                            <div class="tags" style="float:right;text-align:right;padding: 0px;">
                                <span th:each="tag : ${problem.tags}">
                                    <a th:href="'/search?word=' + ${tag.name} + '&type=problem'" rel="tag" th:text="${tag.name}"></a>
                                </span>
                            </div>
                        </td>
                        <td class="solved">
                            <a th:href="@{/admin/problemset/{problem_id}/status(problem_id=${problem.problem_id})} + '/page/1'" title="users solved this problem" th:text="${problem.solved}"></a>
                            <span style="font-size:11px;color:grey;font-family:verdana,Serif,Arial;" title="all submissions"><sub th:text="'/&nbsp;' + ${problem.submit}"></sub></span>
                        </td>
                        <td class="ratio" >
                            <a th:href="@{/admin/problem/edit/{problem_id}(problem_id=${problem.problem_id})}">Edit</a>
                            <a class="problem-data-link" th:problemId="${problem.problem_id}" href=""> Data </a>
                        </td>
                    </tr>
                </table>
            </div>
            <div style="margin:6px 12px;font-size:15px;">
                <div class="left"></div>
                <div class="right">
                    <a th:if="${pageInfo.hasPreviousPage == true}" th:href="@{/admin/problemset/page/{pageNum}(pageNum=${pageInfo.prePage})}" style="color:#000;text-decoration: none;">&larr;</a>
                    <a th:if="${pageInfo.firstPage > 1}" th:href="@{/admin/problemset/page/1}" style="color:#000;text-decoration: none;">1</a>
                    <span th:if="${pageInfo.firstPage > 2}"  >...</span>
                    <span th:each="nav:${pageInfo.navigatepageNums}">
                    <a th:href="@{/admin/problemset/page/{pageNum}(pageNum=${nav})}" th:text="${nav}" th:if="${nav == pageInfo.pageNum}" style="font-weight: bold;color:#000;text-decoration: none;"></a>
                    <a th:href="@{/admin/problemset/page/{pageNum}(pageNum=${nav})}" th:text="${nav}" th:if="${nav != pageInfo.pageNum}" style="color:#000;text-decoration: none;"></a>
                </span>
                    <span th:if="${pageInfo.lastPage < pageInfo.pages}" >...</span>
                    <a th:if="${pageInfo.pages > pageInfo.lastPage}" th:href="@{/admin/problemset/page/{pageNum}(pageNum=${pageInfo.pages})}" th:text="${pageInfo.pages}" style="color:#000;text-decoration: none;"></a>
                    <a th:if="${pageInfo.hasNextPage == true}" th:href="@{/admin/problemset/page/{pageNum}(pageNum=${pageInfo.nextPage})}" style="color:#000;text-decoration: none;">&rarr;</a>
                </div>
            </div>
        </div>
        <div class="sidebar" >
            <div class="sidebox roundbox ">
                <div class="top-link">
                    <div class="title-sidebox">
                        <div class="title-sidebox">Tools Box</div>
                    </div>
                </div>
                <div class="top10" style="margin: 6px;">
                    <b><a th:href="@{/admin/problem/new}">[[#{problemadd}]]</a></b>
                </div>
                <div class="bottom-link">
                </div>
            </div>
        </div>
    </div>
    <div th:replace="common::web-footer"></div>
</div>
<div th:include="admin/problem-data"></div>
</body>
</html>
